#include <stdlib.h> //malloc
#include <string.h> //strcpy
#include <stdio.h>  //printf

int main()
{
    char *s;
    s=(char *) malloc (100);
    if (s == NULL) {
        printf("malloc failed. return here. \n");
        return 1;
    }
    memset(s,0,100);  //the data in memory allocated from malloc is ramdon. it needs to be formatted.

    //s="hello";   // Here you can assign a const string address to "s", but you can't free it.
    strcpy(s, "hello");   //In this way, you are copy the const string "hello" into the new malloced *s
    printf("%s \n", s);
    
    free(s);
    
    return 0;
}
